import jsonschema


def json_assert(resp,status_code,success,code):
    assert status_code == resp.status_code
    schema = {
        "type": "object",
        "required": ["success", "code", "message"],
        "properties": {
            "success": {"const": success},
            "code": {"const": code},
            "message": {"type": "string"}
        }
    }
    jsonschema.validate(resp.json(), schema)